import com.alibaba.fastjson2.*;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import jd.Date;
import jd.Article;
import jd.Identifier;

public class GenImportSQL {
	public static void main(String[] args) {
		String os = System.getProperty("os.name").toLowerCase();
		String path;
		if (os.contains("win")) {
			path = "D:\\03_hy\\hsy\\homework\\pubmed24n\\pubmed24n.ndjson"; // 替换为你的文件路径
		} else {
			path =  path = "../../pubmed24n.ndjson";
		}
		int i = 0;
		Identifier gid = new Identifier();

		Article article;
		try (BufferedReader reader = new BufferedReader(new FileReader(path))) {
			String line;
			while ((line = reader.readLine()) != null) {
				article = JSON.parseObject(line, Article.class);
				article.out_sql(gid);
				if ((i%10000) == 0)
					System.out.printf("select '%d', now();\n", i);
				//if (i > 100000)
				//	break;
				i++;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

